<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Guest
 *
 * @author vampired
 */
// application/forms/Guestbook.php



class Golib_Form_Guest extends Zend_Form {
    public function init() {
            $translator=Zend_Registry::get('Zend_Translate');
            
        // Set the method for the display form to POST
            $this->setAttrib('id','GuestForm');
        $this->setMethod('post');


        $this->addElement('text', 'name', array(
            'label' => $translator->translate('Guest-name'),
            'required' => true,
            'filters' => array('StringTrim'),
            'validators' => array(new Zend_Validate_LessThan(50)
            )
        ));
        
        // Add an email element

        $this->addElement('text', 'email', array(
            'label' => $translator->translate('Guest-mail'),
            'required' => true,
            'filters' => array('StringTrim'),
            'validators' => array(
                'EmailAddress',
            )
        ));



        // Add the comment element

        $this->addElement('textarea', 'message', array(
            'label' => $translator->translate('Guest-message'),
            'required' => true,
            'validators' => array(
                array('validator' => 'LessThan', 'options' => array(300, 300))
            )
        ));



        // Add a captcha

//        $this->addElement('captcha', 'captcha', array(
//            'label' => 'Please enter the 5 letters displayed below:',
//            'required' => true,
//            'captcha' => array(
//                'captcha' => 'Figlet',
//                'wordLen' => 5,
//                'timeout' => 300
//            )
//        ));



        // Add the submit button

        $this->addElement('submit', 'submit', array(
            'ignore' => true,
            'label' => $translator->translate('Guest-Add'),
        ));

        $this->getElement('name')->setAttrib('class','input');
        $this->getElement('email')->setAttrib('class','input');
//        $this->getElement('message')->setAttribs(array('cols'=>60,'rows'=>5));

        // And finally add some CSRF protection

//        $this->addElement('hash', 'csrf', array(
//            'ignore' => true,
//        ));
    }

}